package com.zhiyou10.crowdfunding.service.impl;

import java.util.List;
import java.util.Map;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zhiyou10.crowdfunding.service.ICommentsService;
import com.zhiyou10.crowdfunding.vo.Comments;
import com.zhiyou10.crowdfunding.vo.mapper.CommentsMapper;

@Service("commentsServiceImpl")
public class CommentsServiceImpl implements ICommentsService {
	@Autowired
	private CommentsMapper mapper;

	@Override
	public boolean add(Comments vo) throws Exception {
		// TODO Auto-generated method stub
		return this.mapper.doCreate(vo);
	}

	@Override
	public boolean edit(Comments vo) throws Exception {
		// TODO Auto-generated method stub
		return this.mapper.doUpdate(vo);
	}

	@Override
	public boolean remove(Set<Integer> ids) throws Exception {
		// TODO Auto-generated method stub
		return this.mapper.doRemoveBatch(ids);
	}

	@Override
	public Comments get(Integer id) throws Exception {
		// TODO Auto-generated method stub
		return this.mapper.findById(id);
	}

	@Override
	public List<Comments> list() throws Exception {
		// TODO Auto-generated method stub
		return this.mapper.findAll();
	}

	@Override
	public Long findAllCount() throws Exception {
		// TODO Auto-generated method stub
		return this.mapper.findAllCount();
	}

	/*
	 * @Override public Map<String, Object> list(int currentPage, int lineSize)
	 * throws Exception { Map<String, Integer> map = new HashMap<>();
	 * map.put("currentPage", currentPage); map.put("lineSize", lineSize); return
	 * this.mapper.findAllSplit(map); }
	 */

	@Override
	public List<Comments> findAllSplit(Map<String, Object> map) throws Exception {
		// TODO Auto-generated method stub
		// System.out.println("-----");
		return this.mapper.findAllSplit(map);
	}

	@Override
	public Comments getID(Integer psId) throws Exception {
		// TODO Auto-generated method stub
		return this.mapper.findBy(psId);
	}

	@Override
	public Long findAllCount1(Integer id) throws Exception {
		// TODO Auto-generated method stub
		return this.mapper.findAllCount1(id);
	}

	@Override
	public List<Comments> replyIdList(Integer id) throws Exception {
		// TODO Auto-generated method stub
		return this.mapper.replyIdList(id);
	}

}
